//
//  ByNetUserModel.m
//  beibei_ios
//
//  Created by hebidu on 16/4/15.
//  Copyright © 2016年 hebidu. All rights reserved.
//

#import "ByNetUserModel.h"

@implementation ByNetUserModel

- (void)setAttributes:(NSDictionary *)jsonDic {
    
    [super setAttributes:jsonDic];
    
    self.uid = jsonDic[@"id"];

    /** member_model 记录 用户资料 */
    id member_model = jsonDic[@"member_model"];
    if ([member_model isKindOfClass:[NSDictionary class]]) {
        NSDictionary *member_model_dic = (NSDictionary *)member_model;
        self.nickname = member_model_dic[@"nickname"];
        self.realname = member_model_dic[@"realname"];
        self.head     = [NSString stringWithFormat:@"%@?id=%@&time=%lf", BOYE_AVATAR_URL, self.uid, [NSDate currentDateTimeInterval]];
        self.autn_url = [NSString stringWithFormat:@"%@?id=%@&time=%lf", BOYE_PROFILE_URL, self.uid, [NSDate currentDateTimeInterval]];
        NSLog(@"****%@", self.head);
        NSLog(@"****%@", self.autn_url);

        self.is_auth_e= [NSString stringWithFormat:@"%@", member_model_dic[@"is_auth_e"]];
        self.sex      = member_model_dic[@"sex"];
        self.birthday = member_model_dic[@"birthday"];
        self.qq       = member_model_dic[@"qq"];
        self.score    = member_model_dic[@"score"];
    }
    
    id auth_group_model_list = [jsonDic[@"auth_group_model_list"] firstObject];
    if ([auth_group_model_list isKindOfClass:[NSDictionary class]]) {
        NSDictionary *auth_group_model_list_dic = (NSDictionary *)auth_group_model_list;
        self.title = auth_group_model_list_dic[@"title"];
        self.user_roles = [NSString stringWithFormat:@"%@", auth_group_model_list_dic[@"user_roles"]];
    }
    
    NSLog(@"%@", self);
}

@end
